//
//  ZLPTableViewModel.m
//  TangYi
//
//  Created by dllo on 15/10/27.
//  Copyright (c) 2015年 赵连鹏. All rights reserved.
//

#import "ZLPTableViewModel.h"

@implementation ZLPTableViewModel


- (void)dealloc {
    [_title release];
    [_pic release];
    [_likes release];
    [_type release];
    [_numID release];
    [super dealloc];
}


- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"id"]) {
        self.numID = value;
    }
}

// 归档和反归档
- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:self.title forKey:@"title"];
    [aCoder encodeObject:self.pic forKey:@"pic"];
    [aCoder encodeObject:self.likes forKey:@"likes"];
    [aCoder encodeObject:self.type forKey:@"type"];
    [aCoder encodeObject:self.numID forKey:@"numID"];
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
        self.title = [aDecoder decodeObjectForKey:@"title"];
        self.pic = [aDecoder decodeObjectForKey:@"pic"];
        self.likes = [aDecoder decodeObjectForKey:@"likes"];
        self.type = [aDecoder decodeObjectForKey:@"type"];
        self.numID = [aDecoder decodeObjectForKey:@"numID"];
    }
    return self;
}

@end
